home *** CD-ROM | disk | FTP | other *** search
- Path: lr46pstn.lr.tudelft.nl!koen
- From: koen@lr46pstn.lr.tudelft.nl (Koen D'Hondt)
- Newsgroups: comp.lang.c
- Subject: [Q] Can I do a backtrace of the current execution frame?
- Date: 17 Jan 1996 19:19:16 GMT
- Organization: Ripley Software Development
- Sender: koen@dutlhs1.lr.tudelft.nl
- Message-ID: <4dji3k$fs1@mo6.rc.tudelft.nl>
- NNTP-Posting-Host: lr46pstn.lr.tudelft.nl
-
- Hi,
-
- This is a question for you c-gurus out there.
-
- I'm writing a program and wish to include support for run-time
- debugging. I have several reasons why I want to do this.
- One reason is that the program in question forks itself after initialisation,
- making it not all to pleasing to debug with gdb. Another reason is that
- most errors occur when the program is already running for some time,
- so I lose quite some time in the debugger before the error occurs.
- I know that debugging can be a painstaking activity, so I want to ease that.
-
- What I have so far is the following:
-
- I've installed a number of signal handlers to catch (amongst others)
- SIGSEGV, SIGILL and SIGBUS. Each of these handlers call a routine
- displaying what routine triggered the signal (ie: one level up)
-
- What I actually want to show is a summary of how my program got where it
- is, starting with the executing frame and all the way up the stack.
-
- One solution is to store the name of each routine in a static array when
- it is called, and remove it when the routine exits, but this gives a lot
- of overhead since there are many routines involved and (possible) critical
- routines get called many times. Besides, I want to include this runtime
- feature in the final release version also, so it better be fast.
-
- So my question is: can a program access it's own execution frames, and
- if so, how do I do it?
- [I've looked in the c-faq, but I found nothing of this kind]
-
- If it is any of your aid, I'm doing development on Linux, HP-UX and IRIX.
- The language used is (of course) c.
- Compilers I use are gcc on Linux and the native compilers on HP-UX and IRIX.
- X is not involved, neither is msdos/windows.
-
- Greets,
- Koen D'Hondt.
-
- PS: if you reply by email, send it to koen@dutlhs1.lr.tudelft.nl
- --
- Koen D'Hondt Niels Hilbrink
- koen@dutlhs1.lr.tudelft.nl niels@dutlcc3.lr.tudelft.nl
-
- Ripley Software Development finger niels@dutlcc3.lr.tudelft.nl for more info.
-